fix the function usage in the parser#21
fix the function usage in the parser#21BoyuXiao wants to merge 2 commits intoweAIDB:pypi/0.0.0-alphafrom
Conversation
|
@BoyuXiao Hi! Please clarify how you modify the related files in PG parser :) |
|
1.在原来的PostgreSQLParser.py中会调用ParseRoutineBody(_localctx),这会出现问题,首先是不存在ParseRoutineBody这个函数,但是在PostgreSQLParserBase.py中存在parse_routine_body函数可以使用。但是不能让类PostgreSQLParser直接继承类PostgreSQLParserBase。因为PostgreSQLParserBase中还有get_postgresql_parser函数未定义,而要定义这个函数需要在PostgreSQLParserBase.py中导入PostgreSQLParser来使用,如果按照前面所说继承的话,就需要在PostgreSQLParser.py中导入PostgreSQLParserBase,这会导致循环导入。所以直接把PostgreSQLParserBase中的函数在PostgreSQLParser中定义。 2.PostgreSQLParser中的_localctx未定义,应该是localctx 3.注意把PostgreSQLParserBase中的函数在PostgreSQLParser中定义后,原来的函数调用ParseRoutineBody(_localctx)修改为self.ParseRoutineBody(localctx)
|
|
@BoyuXiao Thanks for your efforts! For 1. and 2., do you directly copy the function code from Moreover, these files can be automatically generated (see #19 for differences) and the error might be attributed to the error generation manner previously. |
|
fix the bug about rule_rewrite #26 |

Fix for Error: name 'ParseRoutineBody' is not defined
Cause of Error: In the createfunc_opt_list method of the PostgreSQLParser class, the call to ParseRoutineBody(_localctx) was made without an instance reference (i.e., missing self.), causing Python to fail to locate the method in the current scope.
Fix for Error: Logger._log() got an unexpected keyword argument 'file'
Cause of Error: In the parse_pg_tree, parse_mysql_tree, and parse_oracle_tree functions, the logging.error(f"An error occurred: {e}", file=sys.stderr) call included the file parameter, which is not supported by Python's Logger._log() method.